# -*- coding: utf-8 -*-

# File Name： __init__.py
# Description :
# Author : lirui
# create_date： 2022/6/3
# Change Activity:
from .resnet import ResNet
from ....common.design_pattern.register.register_factory import REGISTER_FACTORY

_registry_name = 'backbone'


def _build_registry():
    """
    build normal lay registry.

    """
    _register = REGISTER_FACTORY.create_registry(_registry_name)
    _register.add('ResNet', value=ResNet)


_build_registry()  # build when module load.


def build_backbone(cfg=None, callable_name=None):
    """
    build backbone

    Args:
        callable_name: module name
        cfg: must contain num_features;

    Returns:

    """
    return REGISTER_FACTORY.build_from_config(_registry_name, cfg, callable_name)
